#-*- coding:utf-8 -*-
#  @author: hzq <151680523@qq.com>

# @version     $Id:filename.php
from cStringIO import StringIO
import cookielib
from gzip import GzipFile
import urllib2
from urllib2 import *

cj = cookielib.CookieJar()
auth_handler = urllib2.HTTPBasicAuthHandler()


opener = urllib2.build_opener(urllib2.HTTPSHandler(), auth_handler, urllib2.HTTPCookieProcessor(cj))
urllib2.install_opener(opener)

req = Request('https://api.weibo.com/oauth2/access_token?client_id=529618010&client_secret=d39f5d3e6e9eeb7910b5f7fd1187f16e&grant_ty')

handle = urllib2.urlopen(req)

data = handle.read()

print data